//
//  FunnyOfTheDayViewController.h
//  FunnyOfTheDay
//
//  Created by Giorgi Gioshvili on 3/22/09.
//  Copyright __MyCompanyName__ 2009. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "EclipsedView.h"
#import "UIRichLabel.h"
#import "UIImageResizing.h"

#define MILITARY_DATE_KEY @"militaryDate"
#define MAX_PICTURES                    100             //maximum # pictures we support at one time
#define SORT_ORDER_BY_PUBLISH_DATE		@"publish_date" //sort order for the pictures

#define kMinimumGestureLength 25
#define kMaximumVariance	  5


#define kNavigationLeft (-1)
#define kNavigationNone  0
#define kNavigationRight 1

@interface FunnyOfTheDayViewController : UIViewController <UIImagePickerControllerDelegate> {
    UIImageView * imageView;
    IBOutlet UIView * infoView;
    IBOutlet UIView * imageSubmitFormView;
    IBOutlet UIView * imageSubmitUploadingView;
    IBOutlet UIImagePickerController * imagePicker;
    IBOutlet UIView * infoPanel;
    IBOutlet UIView * infoButtonView;
    IBOutlet UIBarButtonItem * prevButton;
    IBOutlet UIBarButtonItem * nextButton;
	IBOutlet UIProgressView * progressBar;
	
    IBOutlet UIView * loadingPane;
    IBOutlet UILabel * dateLabel;
	
    IBOutlet UIRichLabel * imageDescriptionLabel;
    IBOutlet UILabel * imageDateLabel;
    IBOutlet UILabel * imageSizeLabel;
    IBOutlet UILabel * imageSourceLabel;
    IBOutlet UIToolbar * upperToolBar;
    IBOutlet UIToolbar * downToolBar;
    IBOutlet UITextField * submitImageDescriptionTextField;
    IBOutlet UITextField * submitImageSourceTextField;
    IBOutlet UITextField * submitImageEmailTextField;
    IBOutlet CGPoint    gestureStartPoint;

    NSArray * pictureIds;
    int currentPictureIndex;
}

@property (nonatomic, retain) IBOutlet UIView * infoPanel;
@property (nonatomic, retain) IBOutlet UIView * imageSubmitFormView;
@property (nonatomic, retain) IBOutlet UIView * imageSubmitUploadingView;
@property (nonatomic, retain) IBOutlet UIView * infoView;
@property (nonatomic, retain) UIImagePickerController * imagePicker;
@property (nonatomic, retain) IBOutlet UIView * infoButtonView;
@property (nonatomic, retain) IBOutlet UIBarButtonItem * prevButton;
@property (nonatomic, retain) IBOutlet UIBarButtonItem * nextButton;
@property (nonatomic, retain) IBOutlet UIProgressView * progressBar;
@property (nonatomic, retain) IBOutlet UIView * loadingPane;
@property (nonatomic, retain) IBOutlet UILabel * dateLabel;
@property (nonatomic, retain) UIImageView * imageView;
@property (nonatomic, retain) UIToolbar * upperToolBar;
@property (nonatomic, retain) UIToolbar * downToolBar;
@property (nonatomic, retain) UITextField * submitImageDescriptionTextField;
@property (nonatomic, retain) UITextField * submitImageSourceTextField;
@property (nonatomic, retain) UITextField * submitImageEmailTextField;

@property (nonatomic, retain) IBOutlet UIRichLabel * imageDescriptionLabel;
@property (nonatomic, retain) IBOutlet UILabel * imageDateLabel;
@property (nonatomic, retain) IBOutlet UILabel * imageSizeLabel;
@property (nonatomic, retain) IBOutlet UILabel * imageSourceLabel;

- (IBAction)showInfo:(id)sender;
- (IBAction)saveImage:(id)sender;
- (IBAction)nextImage:(id)sender;
- (IBAction)prevImage:(id)sender;
- (IBAction)submitImage:(id)sender;
- (IBAction)submitImageTextEditDidFinish:(id)sender;
- (IBAction)submitImageSubmitClicked:(id)sender;
- (IBAction)submitImageCancelClicked:(id)sender;

- (void)uploadImage;
- (void)loadImage:(int)data;
- (void)refreshTheListOfImageIdsFromServer;
- (void)resetDisplay:(id)object;
- (void)resizeImageViewAsNeeded;
- (void)submitImageHideAndCleanUp;
- (NSString *)readUserSettings;
- (void)saveUserSettings:(NSString *)userEmail;

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo;
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;

@end

